<?php
require('includes/top.php');

$ecompanyName = $_POST["ecompanyName"];				
$ecompanyAdd = $_POST["ecompanyAdd"];
$ePersonInCharge=$_POST['ePersonInCharge'];
$ephone=$_POST['ephcode'].'-'.$_POST['ephone'];
$emobile=$_POST['emobstdCode'].'-'.$_POST['emobile'];
$expert_res_no=$_POST['eresphcode'].'-'.$_POST['expert_res_no'];
$eusername = $_POST["eusername"];		
$epwd = $_POST["epwd"];
$category = $_POST['category'];
$ecategory = $_POST["ecategory"];				
$esubcategory = $_POST["eSubCategory"];
$ewebsiteName=$_POST['ewebsiteName'];
$eprodDealing=$_POST['eprodDealing'];
$country_id=$_POST['country_id'];
$ecomClientsServed=$_POST['ecomClientsServed'];
$eUps=$_POST['eUps'];
$ecomOwnersExprenc=$_POST['ecomOwnersExprenc'];
$awardsAccolade=$_POST['awardsAccolade'];
$compInfo=$_POST['compInfo'];

$sql = "INSERT INTO experts (`expert_res_no`, `experts_phone`, `experts_mob`,`experts_username`, `password`, `expert_subcategory_id`, `company_name`, `company_address`, `website_name`, `product_dealing`, `companies_clients_served`, `companys_USP`, `company_owners_experience`, `awards_accolade`, `expert_cat_id`, `country_id`,`company_info`, `expert_category_id`, `person_in_charge_owner`) VALUES ('$expert_res_no', '$ephone', '$emobile', '$eusername', '$epwd', '$esubcategory', '$ecompanyName', '$ecompanyAdd', '$ewebsiteName', '$eprodDealing', '$ecomClientsServed', '$eUps', '$ecomOwnersExprenc', '$awardsAccolade', '$ecategory', '$country_id', '$compInfo', '$category','$ePersonInCharge')";


$result=mysql_query($sql);
 if($result)
 {
		$userid = mysql_query("select * from experts where experts_username='".$eusername."'");
		$getUserId = mysql_fetch_array($userid);
			$uid = $getUserId['experts_id'];
			echo $uid;

	 foreach($_POST['vcheck'] as $a)
	 {
		 echo $a;
		 $sql1 = "INSERT INTO location (`location`, `user_id`, `user_type`) VALUES ('$a', '$uid', 'Expert')";
		 $result=mysql_query($sql1);
	 }


header("location:add_experts.php");
}
 else
 {
	 echo mysql_error();
 }
ob_flush();
?>
 